<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>ESP32 HTTPS Server: httpsserver::SSLCert Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">ESP32 HTTPS Server
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classhttpsserver_1_1SSLCert.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="classhttpsserver_1_1SSLCert-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">httpsserver::SSLCert Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Certificate and private key that can be passed to the <a class="el" href="classhttpsserver_1_1HTTPSServer.html" title="Main implementation of the HTTP Server with TLS support. Use HTTPServer for plain HTTP...">HTTPSServer</a>.  
 <a href="classhttpsserver_1_1SSLCert.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="SSLCert_8hpp_source.html">SSLCert.hpp</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ad59dc48ab7c1a35afe02d737332de052"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhttpsserver_1_1SSLCert.html#ad59dc48ab7c1a35afe02d737332de052">SSLCert</a> (unsigned char *certData=NULL, uint16_t certLength=0, unsigned char *pkData=NULL, uint16_t pkLength=0)</td></tr>
<tr class="memdesc:ad59dc48ab7c1a35afe02d737332de052"><td class="mdescLeft">&#160;</td><td class="mdescRight">Creates a new <a class="el" href="classhttpsserver_1_1SSLCert.html" title="Certificate and private key that can be passed to the HTTPSServer. ">SSLCert</a>.  <a href="#ad59dc48ab7c1a35afe02d737332de052">More...</a><br /></td></tr>
<tr class="separator:ad59dc48ab7c1a35afe02d737332de052"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a47015d793e39e101668cea8712c866bd"><td class="memItemLeft" align="right" valign="top"><a id="a47015d793e39e101668cea8712c866bd"></a>
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhttpsserver_1_1SSLCert.html#a47015d793e39e101668cea8712c866bd">getCertLength</a> ()</td></tr>
<tr class="memdesc:a47015d793e39e101668cea8712c866bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the length of the certificate in byte. <br /></td></tr>
<tr class="separator:a47015d793e39e101668cea8712c866bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5c38c849bb261bc630b01f5f68611108"><td class="memItemLeft" align="right" valign="top"><a id="a5c38c849bb261bc630b01f5f68611108"></a>
uint16_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhttpsserver_1_1SSLCert.html#a5c38c849bb261bc630b01f5f68611108">getPKLength</a> ()</td></tr>
<tr class="memdesc:a5c38c849bb261bc630b01f5f68611108"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the length of the private key in byte. <br /></td></tr>
<tr class="separator:a5c38c849bb261bc630b01f5f68611108"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af207176d23d8de362e2302f0528a58d5"><td class="memItemLeft" align="right" valign="top"><a id="af207176d23d8de362e2302f0528a58d5"></a>
unsigned char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhttpsserver_1_1SSLCert.html#af207176d23d8de362e2302f0528a58d5">getCertData</a> ()</td></tr>
<tr class="memdesc:af207176d23d8de362e2302f0528a58d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the certificate data. <br /></td></tr>
<tr class="separator:af207176d23d8de362e2302f0528a58d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a53f54e9daaa5e86d7a6c203ea28b35bd"><td class="memItemLeft" align="right" valign="top"><a id="a53f54e9daaa5e86d7a6c203ea28b35bd"></a>
unsigned char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhttpsserver_1_1SSLCert.html#a53f54e9daaa5e86d7a6c203ea28b35bd">getPKData</a> ()</td></tr>
<tr class="memdesc:a53f54e9daaa5e86d7a6c203ea28b35bd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the private key data. <br /></td></tr>
<tr class="separator:a53f54e9daaa5e86d7a6c203ea28b35bd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a31d7697c089188afb23545c22c26894e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhttpsserver_1_1SSLCert.html#a31d7697c089188afb23545c22c26894e">setPK</a> (unsigned char *_pkData, uint16_t length)</td></tr>
<tr class="memdesc:a31d7697c089188afb23545c22c26894e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the private key in DER format.  <a href="#a31d7697c089188afb23545c22c26894e">More...</a><br /></td></tr>
<tr class="separator:a31d7697c089188afb23545c22c26894e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab55f58e4c49aa31e0e1a2a560248c14b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhttpsserver_1_1SSLCert.html#ab55f58e4c49aa31e0e1a2a560248c14b">setCert</a> (unsigned char *_certData, uint16_t length)</td></tr>
<tr class="memdesc:ab55f58e4c49aa31e0e1a2a560248c14b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the certificate data in DER format.  <a href="#ab55f58e4c49aa31e0e1a2a560248c14b">More...</a><br /></td></tr>
<tr class="separator:ab55f58e4c49aa31e0e1a2a560248c14b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a98ac0171081ce48684d5e7e15545cefc"><td class="memItemLeft" align="right" valign="top"><a id="a98ac0171081ce48684d5e7e15545cefc"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhttpsserver_1_1SSLCert.html#a98ac0171081ce48684d5e7e15545cefc">clear</a> ()</td></tr>
<tr class="memdesc:a98ac0171081ce48684d5e7e15545cefc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clears the key buffers and deletes them. <br /></td></tr>
<tr class="separator:a98ac0171081ce48684d5e7e15545cefc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Certificate and private key that can be passed to the <a class="el" href="classhttpsserver_1_1HTTPSServer.html" title="Main implementation of the HTTP Server with TLS support. Use HTTPServer for plain HTTP...">HTTPSServer</a>. </p>
<p><b>Converting PEM to DER Files</b></p>
<p>Certificate: </p><div class="fragment"><div class="line">openssl x509 -inform PEM -outform DER -in myCert.crt -out cert.der</div></div><!-- fragment --><p>Private Key: </p><div class="fragment"><div class="line">openssl rsa -inform PEM -outform DER -in myCert.key -out key.der</div></div><!-- fragment --><p><b>Converting DER File to C Header</b></p>
<div class="fragment"><div class="line">echo &quot;#ifndef KEY_H_&quot; &gt; ./key.h</div><div class="line">echo &quot;#define KEY_H_&quot; &gt;&gt; ./key.h</div><div class="line">xxd -i key.der &gt;&gt; ./key.h</div><div class="line">echo &quot;#endif&quot; &gt;&gt; ./key.h</div></div><!-- fragment --> </div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ad59dc48ab7c1a35afe02d737332de052"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad59dc48ab7c1a35afe02d737332de052">&#9670;&nbsp;</a></span>SSLCert()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">httpsserver::SSLCert::SSLCert </td>
          <td>(</td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>certData</em> = <code>NULL</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>certLength</em> = <code>0</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>pkData</em> = <code>NULL</code>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>pkLength</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Creates a new <a class="el" href="classhttpsserver_1_1SSLCert.html" title="Certificate and private key that can be passed to the HTTPSServer. ">SSLCert</a>. </p>
<p>The certificate and key data may be NULL (default values) if the certificate is meant to be passed to <a class="el" href="namespacehttpsserver.html#a0c2a1f6a28893f118e6980dab067d651" title="Creates a self-signed certificate on the ESP32. ">createSelfSignedCert()</a>.</p>
<p>Otherwise, the data must reside in a memory location that is not deleted until the server using the certificate is stopped.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">certData</td><td>The certificate data to use (DER format) </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">certLength</td><td>The length of the certificate data </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">pkData</td><td>The private key data to use (DER format) </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">pkLength</td><td>The length of the private key </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ab55f58e4c49aa31e0e1a2a560248c14b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab55f58e4c49aa31e0e1a2a560248c14b">&#9670;&nbsp;</a></span>setCert()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void httpsserver::SSLCert::setCert </td>
          <td>(</td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>_certData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the certificate data in DER format. </p>
<p>The data has to reside in a place in memory that is not deleted as long as the server is running.</p>
<p>See <a class="el" href="classhttpsserver_1_1SSLCert.html" title="Certificate and private key that can be passed to the HTTPSServer. ">SSLCert</a> for some information on how to generate DER data.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">_certData</td><td>The data of the certificate </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>The length of the certificate </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a31d7697c089188afb23545c22c26894e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a31d7697c089188afb23545c22c26894e">&#9670;&nbsp;</a></span>setPK()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void httpsserver::SSLCert::setPK </td>
          <td>(</td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>_pkData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t&#160;</td>
          <td class="paramname"><em>length</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets the private key in DER format. </p>
<p>The data has to reside in a place in memory that is not deleted as long as the server is running.</p>
<p>See <a class="el" href="classhttpsserver_1_1SSLCert.html#ad59dc48ab7c1a35afe02d737332de052" title="Creates a new SSLCert. ">SSLCert()</a> for some information on how to generate DER data.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">_pkData</td><td>The data of the private key </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">length</td><td>The length of the private key </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/home/frank/Projekte/esp32/https_server/esp32_https_server/src/<a class="el" href="SSLCert_8hpp_source.html">SSLCert.hpp</a></li>
<li>/home/frank/Projekte/esp32/https_server/esp32_https_server/src/SSLCert.cpp</li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespacehttpsserver.html">httpsserver</a></li><li class="navelem"><a class="el" href="classhttpsserver_1_1SSLCert.html">SSLCert</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
